version: '3.8'

services:
  postgres_b:
    image: postgres:latest
    container_name: "postgres_b"
    environment:
      POSTGRES_DB: "books"
      POSTGRES_USER: "postgres"
      POSTGRES_PASSWORD: "postgres"
      PGDATA: "/var/lib/postgresql/data/pgdata"
    ports:
      - "5632:5432"
    volumes:
      - ./conf/postgres_b:/scripts
      #- postgres-data:/var/lib/postgresql/data
    networks:
      - postgres

  postgres_b1:
    image: postgres:latest
    container_name: "postgres_b1"
    environment:
      POSTGRES_DB: "books"
      POSTGRES_USER: "postgres"
      POSTGRES_PASSWORD: "postgres"
      PGDATA: "/var/lib/postgresql/data/pgdata"
    ports:
      - "5633:5432"
    volumes:
      - ./conf/postgres_b1/:/scripts/
      #- postgres-data:/var/lib/postgresql/data
    networks:
      - postgres

  postgres_b2:
    image: postgres:latest
    container_name: "postgres_b2"
    environment:
      POSTGRES_DB: "books"
      POSTGRES_USER: "postgres"
      POSTGRES_PASSWORD: "postgres"
      PGDATA: "/var/lib/postgresql/data/pgdata"
    ports:
      - "5634:5432"
    volumes:
      - ./conf/postgres_b2/:/scripts/
      #- postgres-data:/var/lib/postgresql/data
    networks:
      - postgres

  postgres_b3:
    image: postgres:latest
    container_name: "postgres_b3"
    environment:
      POSTGRES_DB: "books"
      POSTGRES_USER: "postgres"
      POSTGRES_PASSWORD: "postgres"
      PGDATA: "/var/lib/postgresql/data/pgdata"
    ports:
      - "5635:5432"
    volumes:
      - ./conf/postgres_b3/:/scripts/
      #- postgres-data:/var/lib/postgresql/data
    networks:
      - postgres

networks:
  postgres:
    driver: bridge

volumes:
  postgres-data:
    driver: local